import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";

/**
 * 组合 布局 中 右侧 导航条
 * 语言切换
 * 站内消息
 * 常用功能(租户切换/角色切换/个人中心/退出登录)
 * @date 2019-03-07
 */
import React from 'react';
import { getEnvConfig } from "../../../utils/iocUtils";
import DefaultNoticeIcon from "../DefaultNoticeIcon";
import DefaultCommonSelect from "../DefaultCommonSelect";
import ThemeButton from "../../DefaultLayout/components/NormalHeader/ThemeButton";

var DefaultHeaderRight = /*#__PURE__*/function (_React$Component) {
  _inherits(DefaultHeaderRight, _React$Component);

  var _super = _createSuper(DefaultHeaderRight);

  function DefaultHeaderRight() {
    var _this;

    _classCallCheck(this, DefaultHeaderRight);

    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    _this = _super.call.apply(_super, [this].concat(args));
    _this.config = getEnvConfig();
    return _this;
  }

  _createClass(DefaultHeaderRight, [{
    key: "render",
    value: function render() {
      var _this$props = this.props,
          _this$props$extraHead = _this$props.extraHeaderRight,
          extraHeaderRight = _this$props$extraHead === void 0 ? null : _this$props$extraHead,
          dispatch = _this$props.dispatch;
      var _this$config = this.config,
          TRACE_LOG_ENABLE = _this$config.TRACE_LOG_ENABLE,
          MULTIPLE_SKIN_ENABLE = _this$config.MULTIPLE_SKIN_ENABLE,
          MULTIPLE_LANGUAGE_ENABLE = _this$config.MULTIPLE_LANGUAGE_ENABLE; // let hasWebsocketUrl = false;
      // if (
      //   WEBSOCKET_URL !== ['BUILD_', 'WEBSOCKET_', 'HOST'].join('') &&
      //   WEBSOCKET_URL !== 'undefined'
      // ) {
      //   hasWebsocketUrl = WEBSOCKET_URL;
      // } else {
      //   hasWebsocketUrl = false;
      // }

      var isTraceLog = false;

      try {
        isTraceLog = TRACE_LOG_ENABLE ? JSON.parse(TRACE_LOG_ENABLE) : false;
      } catch (e) {
        isTraceLog = false;
      }

      var isUed = false;

      try {
        isUed = MULTIPLE_SKIN_ENABLE ? JSON.parse(MULTIPLE_SKIN_ENABLE) : false;
      } catch (e) {
        isUed = false;
      }

      var hasMultiLanguage = true;

      try {
        hasMultiLanguage = MULTIPLE_LANGUAGE_ENABLE ? JSON.parse(MULTIPLE_LANGUAGE_ENABLE) : true;
      } catch (e) {
        hasMultiLanguage = true;
      }

      return /*#__PURE__*/React.createElement(React.Fragment, null, extraHeaderRight, hasMultiLanguage && null, isUed && /*#__PURE__*/React.createElement(ThemeButton, null), /*#__PURE__*/React.createElement(DefaultNoticeIcon, {
        key: "notice-message",
        popupAlign: {
          offset: [25, -8]
        }
      }), /*#__PURE__*/React.createElement(DefaultCommonSelect, {
        key: "common-switch"
      }));
    }
  }]);

  return DefaultHeaderRight;
}(React.Component);

export default DefaultHeaderRight;